package com.twu.biblioteca;

import  java.io.*;
public class User {
    private static int noOfUsers = 0;
    private String id;
    private String name;
    private String password;
    private String emailId;
    private String phoneNo;
    private boolean loggedIn = false;

    public void setLoggedIn (boolean value) {
        loggedIn = value;
    }

    public boolean isLoggedIn() {
        return loggedIn;
    }

    public String getId() {
        return id;
    }

    public String getPassword() {
        return password;
    }

    public User(String userName, String userPassword, String userEmailId, String userPhoneNo) {
        noOfUsers++;
        int copyOfNoOfUsers = noOfUsers;
        name = userName;
        password = userPassword;
        emailId = userEmailId;
        phoneNo = userPhoneNo;
        id = "";
        for (int i = 7; i > -1 ; i--) {
            if (i == 3) {
                id = "-" + id;
                continue;
            }
            if (copyOfNoOfUsers != 0) {
            int reminder = copyOfNoOfUsers%10;
            copyOfNoOfUsers /= 10;
            id = reminder + id;
            }
            else id = "1" + id;
        }
    }

    public void display() {
        System.out.println("User Id : " + id);
        System.out.println("User Name : " + name);
        System.out.println("Email Id : " + emailId);
        System.out.println("Phone No : " + phoneNo);
    }
}
